const Router = require('koa-router')
const ReportController = require('../controllers/report.controller')
const jwt = require('../middlewares/jwt.middleware')
const isRole = require('../middlewares/role.middleware')

const router = new Router()
const reportController = new ReportController()
router.prefix('/api/reports')

router.get('/', jwt, reportController.findAll)

router.post('/', jwt, reportController.addOne)

router.get('/:id', jwt, reportController.findOne)

router.patch('/:id', jwt, reportController.updateOne)

router.delete('/:id', jwt, isRole(['admin', 'auditor']), reportController.deleteOne)

module.exports = router